const express = require('express');
const expressJoi = require('@escook/express-joi');
const artcate_handler = require('../router_handle/artcate');
const { add_cate_schema, delete_cate_schema, get_cate_schema, update_cate_schema } = require('../schema/artcate');
const router = express.Router();

// 获取文章分类的列表数据
router.get('/cates', artcate_handler.getArticleCates);
// expressJoi为局部中间件
router.post('/addcates', expressJoi(add_cate_schema), artcate_handler.addArticleCates);
router.get('/deletecate/:id', expressJoi(delete_cate_schema), artcate_handler.deleteArticleCates);
router.get('/cates/:id', expressJoi(get_cate_schema), artcate_handler.getArtcateById);
router.post('/updatecate', expressJoi(update_cate_schema), artcate_handler.updateArtcateById);

module.exports = router;